<%--
Created by IntelliJ IDEA.
User: jt
Date: 2021/1/26
Time: 10:20
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>廊坊国际展览中心</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/style.css">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="js/jquery-1.9.1.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="/Scripts/jquery.unobtrusive-ajax.min.js"></script>
          
    <script type="text/javascript">
　　
    //平台、设备和操作系统
    var system = {
        win: false,
        mac: false,
        xll: false,
        ipad: false
    };
    //检测平台
    var p = navigator.platform;
    system.win = p.indexOf("Win") == 0;
    system.mac = p.indexOf("Mac") == 0;
    system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
    system.ipad = (navigator.userAgent.match(/iPad/i) != null) ? true : false;
    //跳转语句，如果是手机访问就自动跳转到" "里的页面
    if (system.win || system.mac || system.xll || system.ipad) {

    } else {

        window.location.href = "/HomePhoto/Index";
    }
    </script>
  </head>

 	<body class="index">
         <div class="top">
        	<div class="container">
            	<div class="clearfix">
                	<div class="pull-left hidden-xs line-height">欢迎进入廊坊国际展览中心！</div>
                    <div class="pull-right">

                        <div class="pull-left top-a line-height">
                        	<a href="#">会员登录</a>
                            <span>|</span>
                            <a href="register.jsp">注册</a>


                        </div>
                        <div class="pull-left right-a line-height">
                        	<a role="button" class="top-btn active">中文</a>
                            <!-- <a role="button" class="top-btn" href="/Home/Index_en">ENGLISH</a> -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="nav-top">
        	<div class="container">
            	<div class="clearfix">
                	<div class="pull-left logo"><a href=""><img src="IMG/LinkImg/20170329140524QQ图片20170329140442.png"></a></div>
                    <div class="pull-left logo-txt"><img src="IMG/LinkImg/2017030354015logo-txt.png"></div>
                    <nav class="navbar navbar-default">
                        <div>
                            <!-- Brand and toggle get grouped for better mobile display -->
                            <div class="navbar-header">
                                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                                    <span class="sr-only">Toggle navigation</span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                </button>
                            </div>
    
    
                            <!-- Collect the nav links, forms, and other content for toggling -->
                            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                                <ul class="nav navbar-nav">
                                    <li class="active"><a href="index.jsp">首页</a></li>
                                    <!-- <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">关于我们</a>
                                        <ul class="dropdown-menu">
                                            <li class="list-top"></li>
                                                <li><a href="/Home/News?tid=25&cid=29">>公司介绍</a></li>
                                                <li><a href="/Home/News?tid=25&cid=32">>公司荣誉</a></li>
                                                <li><a href="/Home/News?tid=25&cid=41">>魅力会展</a></li>
    
    
    
    
                                        </ul>
                                    </li> -->
                                    <!-- <li><a href="/Home/Lable_href?id=1">展会排期</a></li>
                                    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">参展指南</a>
                                        <ul class="dropdown-menu">
                                            <li class="list-top"></li>
                                                <li><a href="/Home/News?tid=3&cid=11">>我是主办方</a></li>
                                                <li><a href="/Home/News?tid=3&cid=34">>我是参展商</a></li>
                                                <li><a href="/Home/News?tid=3&cid=46">>特装报馆</a></li>
    
    
    
    
                                        </ul>
                                    </li> -->
                                    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">展馆中心</a>
                                        <ul class="dropdown-menu">
                                            <li class="list-top"></li>
                                                <li><a href="/Home/News?tid=1&cid=2">>查看展馆</a></li>
                                                <!-- <li><a href="/Home/News?tid=1&cid=33">></a></li> -->
    
                                        </ul>
                                    </li>
    
                                    
                                    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">展会中心</a>
                                        <ul class="dropdown-menu">
                                            <li class="list-top"></li>
                                                <li><a href="/Home/News?tid=7&cid=15">>展会详情</a></li>
                                                <li><a href="/Home/News?tid=7&cid=42">>展览服务</a></li>
    
    
    
    
                                        </ul>
                                    </li>
                                    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">周边配套</a>
                                        <ul class="dropdown-menu">
                                            <li class="list-top"></li>
                                                <li><a href="/Home/News?tid=6&cid=14">>周边酒店</a></li>
                                                <li><a href="/Home/News?tid=6&cid=35">>周边景点</a></li>
                                                <li><a href="/Home/News?tid=6&cid=36">>周边美食</a></li>
    
    
    
    
                                        </ul>
                                    </li>
    
                                    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">联系我们</a>
                                        <ul class="dropdown-menu">
                                            <li class="list-top"></li>
                                                <li><a href="/Home/News?tid=37&cid=38">>咨询电话</a></li>
                                                <li><a href="/Home/News?tid=37&cid=43">>交通路线</a></li>
    
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                            <!-- /.navbar-collapse -->
                        </div>
                        <!-- /.container-fluid -->
                    </nav>
                </div>
            </div>
        </div>
          
<script src="/Scripts/jquery-1.8.2.min.js"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script>
        //更换验证码图片
        function changeVCode() {
            //这里要加随机数，因为相同的，浏览器默认不重新请求
            //$("#vCodeImg").attr("src", "VCode" + Math.random());
            $("#vCodeImg").attr("src", "VCode?" + Math.random());
        }
        //获取并分析服务器端传送过来的验证码
        function getVCode() {
            var cookies = document.cookie.split(";");
            var vCode;
            for (var x = 0; x < cookies.length; x++) {
                //不等于-1证明找到了VCODE验证码
                if (cookies[x].indexOf("vCode") != -1) {
                    vCode = cookies[x].replace(" ", "").substr(6, 4);
                }
            }
            return vCode;
        }

        function begin() {
            var go = false;

            var UserName = $("#UserName").val();
            var PassWord = $("#PassWord").val();
            var vcode = $("#vcode").val();
            if (UserName == "") {
                alert("请输入账号");
            }
            else if (PassWord == "") {
                alert("请输入密码");
            }
            else if (vcode != getVCode()) {
                alert("验证码不正确");
            }
            else {
                go = true;
            }
            return go;
        }

        function success(res) {
            if (res == "1") {
                window.location.href = "/Home/Index";
            }
            else if (res == "-2") {
                alert("验证码错误");
            }
            else if (res == "-1") {
                alert("账号密码错误");
            }
            else {
                alert("登陆错误");
            }

        }
        $(function () {
            $("[zc=zc]").on("click", function () {
                window.location = "/User/register";
            });

            $("[wjmm=wjmm]").on("click", function () {
                var UserName = $("#UserName").val();
                if (UserName != null && UserName != "") {
                    $.post("/user/Forget", { UserName: UserName }, function (res) {
                        if (res > 0) {
                            alert("密码已发送到您的邮箱！请注意查看");
                        } else {
                            alert("错误！账号或邮箱不存在");
                        }
                    });
                } else {
                    alert("请填写用户名");
                }

            });
        });
        //设置cookie
        function setCookie(name,value,time){
            var strsec = getsec(time);
            var exp = new Date();
            exp.setTime(exp.getTime() + strsec*1);
            document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
        }

        function getsec(str){
            // alert(str);
            var str1=str.substring(1,str.length)*1;
            var str2=str.substring(0,1);
            if (str2=="s"){
                return str1*1000;
            }else if (str2=="h"){
                return str1*60*60*1000;
            }else if (str2=="d"){
                return str1*24*60*60*1000;
            }
        }

        //读取cookie
        function getCookie(name)
        {
            var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
            if(arr=document.cookie.match(reg))
                return unescape(arr[2]);
            else
                return null;
        }
        //通过异步请求
      function anniu() {

          console.log("触发按钮")
          use=$('.username').val()
          pas=$('.password').val()
          $.ajax({

              headers: {},//需要的话可以加
              type: 'post',
              url: 'http://localhost:8080/login',
              dataType: 'json',
              data: {
                  "username": $('.username').val(),
                  "password": $('.password').val()
              },
              //等待后端返回数据
              success: function (res) {
                  console.log("")
                  console.log(res);
                  if(res){
                      // document.cookie="user="+use;
                      // window.location="index.jsp";
                      setCookie("user",use,"s900")
                      if(getCookie("user")){
                          alert("登录成功,当前登录账号为"+getCookie("user"));
                          window.location="index.jsp";
                      }
                  }else{
                      alert("账号或密码错误")

                  }
              }
          })
      }
      function chushihua(){
            if(getCookie("user")){
                alert("已登录");
                window.location.href="index.jsp";
            }
      }
      chushihua();

    </script>
    <!--if ie7-->
    <style>
        .regi_div i input{height: 36px;}
    </style>
    <!--end if-->

<link href="css/login.css" rel="stylesheet" />
<!--main-->

<div class="w main">

    <form action="" data-ajax="true" data-ajax-begin="begin" data-ajax-success="success" id="form0" method="post" onsubmit="return false">        <div class="item item-username">
            <input id="UserName" class="txt-input txt-username username" type="text" placeholder="请输入用户名" value="" name="usename">
            <b class="input-close" style="display: none;"></b>
        </div>
        <div class="item item-password">
            <input id="PassWord" class="txt-input txt-password ciphertext password" type="password" placeholder="请输入密码" name="password" style="display: inline;">

            <b class="tp-btn btn-off"></b>
        </div>
    
        <div class="item item-login-option">
                <!-- <img src="VCode" id="vCodeImg" onclick="changeVCode()" width="110" height="30" style="margin-bottom: 20px;"> -->
               <span class="retrieve-password"><a style="cursor:pointer" wjmm="wjmm">找回密码</a> </span>
            <b class="tp-btn btn-off"></b>
        </div>
        <div class="ui-btn-wrap">
            <input name="" type="submit" value="用户登录" class="ui-btn-lg ui-btn-primary" onclick="anniu()"/>

        </div>
        <div class="ui-btn-wrap"><a class="ui-btn-lg ui-btn-danger" href="register.html">没有账号？立即注册</a> </div>
</form></div>
<!--main-->

        <ul class="toolbar">
               <li class="toolbar-item toolbar-item-jsq">
            <span class="toolbar-layer toolbar-layer-one">客服热线：<br>
                400-600-6453</span>
        </li>
        <li class="toolbar-item toolbar-item-kefu">
            <a href="#" class="block"></a>
        </li>
        <li class="toolbar-item toolbar-item-weixin">
                <span class="toolbar-layer toolbar-layer-one">
                <img src="IMG/LinkImg/20170405112755订阅号二维码.jpg" alt="Alternate Text" />
                </span>
        </li>
            <li class="toolbar-item toolbar-item-weixin toolbar-item-weibo">
            	<a href="" class="block"></a>
            </li>
            <li class="toolbar-item toolbar-item-top">
            	<span class="toolbar-layer toolbar-layer-one">
                <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a></div>
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "1", "bdSize": "24" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script></span>
            </li>
            <li class="toolbar-item toolbar-item-six"><a href="" class="block"></a></li>
        </ul>
         <script>
             $(function () {
                 $(".news-left-more").on("click", function () {
                     $(".news-left").addClass("fixed-right");
                     $(".news-show").show();
                 });
                 $(".news-show").on("click", function () {
                     $(".news-left").removeClass("fixed-right");
                     $(this).hide();
                 });
             });
             
</script>
    </body>
</html>